home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Corel Professional Photo…etahs, Leopards & Jaguars
/
Corel Professional Photos - 1994 - 134 - Cheetahs, Leopards and Jaguars.ISO
/
drwmodel
/
mrktdraw.mst
< prev
next >
Wrap
Text File
|
1993-09-16
|
28KB
|
767 lines
'' $Keywords: update.mst 1.7 28Jul93 10:12am$ $nokeywords$
'**************************************************************************
'* CorelDRAW! 4 Update script
'**************************************************************************
'' Date Name Reason
''-------------------------------------------------------------------------
'' JUL 14 1993 Ibrahim Sallam Create
'$INCLUDE 'setupapi.inc'
''C functions
DECLARE SUB InitializeInstall LIB "mscuistf.dll" (hInstance%, hMainWind% )
DECLARE SUB ShutDownInstall LIB "mscuistf.dll"
DECLARE SUB RegisterFont LIB "mscuistf.dll" (szFOTName$, szTTFName$)
DECLARE SUB FileChangeString LIB "mscuistf.dll" (szFile1$, szFile2$, szString1$, szString2$)
DECLARE SUB FRecalcOptFiles LIB "mscuistf.dll" (iType%, szNeeds$)
DECLARE FUNCTION FIsDrawExist LIB "mscuistf.dll" (szFileName$, szDest$) AS INTEGER
DECLARE FUNCTION IsSectionKeyExist LIB "mscuistf.dll" (szSectionName$, szKeyName$) AS INTEGER
DECLARE SUB FAddFileToCopyList LIB "mscuistf.dll" (AppendSect$, Section$, FilterName$, SourceDir$, FiltersDir$)
DECLARE SUB CommentIniSection LIB "mscuistf.dll" (szFileName$, szTempFile$, szSection$, szPath$ )
DECLARE FUNCTION GetFilenameFromPath LIB "mscuistf.dll" (szPath$) AS INTEGER
DECLARE FUNCTION IsTTFEnabled LIB "mscuistf.dll" AS INTEGER
DECLARE FUNCTION FGetBootDrive LIB "mscuistf.dll" AS INTEGER
DECLARE FUNCTION FModifyFile LIB "mscuistf.dll" (szFileName$, szList$, szWhere$) AS INTEGER
DECLARE FUNCTION IsWinForWorkgroups LIB "mscuistf.dll" AS INTEGER
'$INCLUDE 'setupvar.inc'
''Strings for loading string resources
GLOBAL szString$
CONST STRINGLEN = 128
szString$ = string$( STRINGLEN+1, 32 )
''setup main window
''CONST LOGO = 9100 ''must match the constant in dialogs.h
CONST LOGO3 = 9115 ''must match the constant in dialogs.h
SetTitle TR_TITLE
SetBitmap "mscuistf.dll", LOGO3
''SetBitmap "mscuistf.dll", LOGO
InitializeInstall hinstFrame(), HwndFrame() ''corel style buttons; max window
'$INCLUDE 'msdetect.inc'
'''$DEFINE DEBUG ''Define for script development/debugging
''Dialog ID's
''Note: These constants MUST match the constants in dialogs.h
CONST DRAWWELCOME = 9900
CONST DRAWASKQUIT = 9901
CONST DRAWDESTPATH = 9902
CONST DRAWERROREXITFAILURE= 9903
CONST DRAWEXITQUIT = 9904
CONST DRAWEXITSUCCESS = 9905
CONST DRAWTOOBIG = 9906
CONST DRAWERRORBADPATH = 9907
CONST DRAWWAIT = 9908
CONST DRAWABOUT = 9909
CONST DRAWASKINSTALL = 9910
CONST DRAWDESTPATHWARNING = 9911
CONST BILLBOARD = 9912
CONST DRAWSUCCESS = 9913
CONST DRAWWELCOMEHELP = 9914
CONST DRAWWAITCONFIGER = 9915
CONST DRAWSHARE = 9916
CONST DRAWSHAREHELP = 9917
CONST DRAWERRORDRAWEXIST = 9920
CONST FALSE = 0
CONST TRUE = 1
''Constants representing each line in the custinst dialog
CONST DRAW = 1
CONST CHART = 2
CONST SHOW = 3
CONST PHOTO = 4
CONST MOVE = 5
CONST TRACE = 6
CONST MOSAIC = 7
CONST SCANNERS = 8
CONST FILTERS = 9 ''Does not have custom dialog
CONST FONTTT = 10
CONST NUMCUST = FONTTT
CONST MAIN = NUMCUST + 1
CONST NUMGROUPS = MAIN
GLOBAL DrivesList$ ''experemental variable for the drives list
DrivesList$ = "DrivesList"
GLOBAL TempList$ '' Used for Temp lists
TempList$ = "TempList"
GLOBAL aszNEEDS$
aszNEEDS$ = "FilesNeeds"
GLOBAL bTooBig%
bTooBig% = FALSE
GLOBAL bBadPath%
bBadPath% = FALSE
GLOBAL bBack%
bBack% = FALSE
GLOBAL DIR(NUMGROUPS) AS STRING ''list of directories for main options
GLOBAL WINDIR$ ''Windows directory.
GLOBAL WINSYSDIR$ ''Windows directory.
GLOBAL WINDRIVE$ ''Windows drive letter.
GLOBAL DEST$ ''destination directory.
GLOBAL szFontDir$ ''directory for .ttf fonts
GLOBAL bWindowsIsNetworked%
GLOBAL bWindowsForWorkgroups%
GLOBAL bMakeCorelSection% '' if not CorelGraphics4 section in win.ini, make one
GLOBAL szWWinDir$ ''Writable Windows directory
GLOBAL TOOLGROUP$ '' Group in which tools are to be installed
TOOLGROUP$ = "Draw4 Working Model"
''Variables to fake subroutines with parameters
GLOBAL Dialog%
GLOBAL szTempVar$
''Globals for WaitOn and WaitOff
GLOBAL nWaiting%
GLOBAL CursorSave%
GLOBAL SrcDir$ '' Directory where files can be found
SrcDir$ = GetSymbolValue("STF_SRCDIR")
GLOBAL InfFile$
''local MSTest functions
DECLARE SUB WaitOnBig
DECLARE SUB WaitOn
DECLARE SUB WaitOff
DECLARE SUB SetDirectories
DECLARE SUB AddFilesToCopyList
DECLARE SUB CalculateRequiredSpace
DECLARE SUB WrapFileChangeString( szFile1$, szFile2$, szString1$, szString2$ )
DECLARE SUB WrapCommentIniSection( szFileName$, szTempFile$, szSection$, szPath$ )
DECLARE SUB CheckBackupFile( szFile1$, szFile2$ )
DECLARE FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) AS INTEGER
DECLARE FUNCTION MakePath( szDir$, szFile$ ) AS STRING
DECLARE FUNCTION MakeDir( szDir$ ) AS STRING
DECLARE SUB AddRedistSection( szSection$)
INIT:
'' set waiting cursor
nWaiting% = 0
WaitOn
''Set default directory names
WINDIR$ = GetWindowsDir
WINSYSDIR$ = GetWindowsSysDir
WINDRIVE$ = MID$(WINDIR$, 1, 1)
OpenLogfile MakePath(WINDIR$, "MRKTDRAW.LOG"), 0
bWindowsForWorkgroups% = IsWinForWorkgroups
IF bWindowsForWorkgroups% THEN
WriteToLogFile "Windows For Workgroups >>>>"
ENDIF
InfFile$ = "MRKTDRAW.INF"
bWindowsIsNetworked% = IsDriveNetwork( MID$(WINSYSDIR$,1,1) )
DEST$ = WINDRIVE$ + ":\"+"DRAW4"
IF bWindowsIsNetworked% THEN
szWWinDir$ = WINDIR$
ELSE
szWWinDir$ = WINSYSDIR$
ENDIF
'' Some Info to the Log File
WriteToLogFile "Installing CorelDRAW! 4 (Working Model)"
IF bWindowsIsNetworked% THEN
WriteToLogFile TR_NETWINDOWS
ENDIF
''find and read .inf file
ReadInfFile GetSymbolValue("STF_CWDDIR") + InfFile$
''Get Drives List
GetValidDrivesList(DrivesList$)
'' Put up the Welcome dialog
WELCOME:
WaitOff
Dialog% = DRAWWELCOME
sz$ = UIStartDlg( "mscuistf.dll", Dialog%, "FInfoDlgProc", DRAWWELCOMEHELP, "FHelpDlgProc" )
SELECT CASE sz$
CASE "CONTINUE"
UIPop 1
CASE "ABOUT"
Dialog% = DRAWABOUT
GOSUB INFO
GOTO WELCOME
CASE "REACTIVATE"
GOTO WELCOME
CASE ELSE
GOSUB ASKQUIT
GOTO WELCOME
END SELECT
GETDIR:
GOSUB GetAppsMainDir
SetDirectories
sz$ = UIStartDlg("mscuistf.dll", DRAWWAIT, "FModelessDlgProc", 0, "")
AddFilesToCopyList
UIPop 1
GOSUB ASKINSTALL
INSTALL:
WriteToLogFile "INSTALL:"
WaitOn
''Make sure there is enough space for Updating CorelDRAW!
WaitOnBig
CalculateRequiredSpace
IF bTooBig% THEN
Dialog% = DRAWTOOBIG
GOSUB INFO
GOSUB ASKQUIT
GOTO GETDIR
ENDIF
CheckBackupFile MakePath(WINDIR$,"win.ini"), MakePath(WINDIR$,"win.cor")
CheckBackupFile MakePath(WINDIR$,"reg.dat"), MakePath(WINDIR$,"reg.cor")
CheckBackupFile MakePath(WINDIR$,"progman.ini"), MakePath(WINDIR$,"progman.cor")
ConfigDir$ = GetIniKeyString(TR_WIN_INI, "CorelGraphics4", "Dir")
IF ConfigDir$ <> "" THEN
IF DoesFileExist( MakePath(ConfigDir$, "CORELAPP.INI"), femExists ) = 0 THEN
bMakeCorelSection% = TRUE
ENDIF
IF DoesFileExist( MakePath(ConfigDir$, "CORELAPP.BAK"), femExists ) = 1 THEN
RemoveFile MakePath(ConfigDir$, "CORELAPP.BAK"), cmoForce
ENDIF
ELSE
bMakeCorelSection% = TRUE
ENDIF
CreateDir MakePath( DIR(MAIN), TR_AUTOBACK ), cmoNone
''Copy all the files over
WaitOff
WriteToLogFile "START CopyFilesInCopyList"
CopyFilesInCopyList
WriteToLogFile "END CopyFilesInCopyList"
WaitOn
sz$ = UIStartDlg("mscuistf.dll", DRAWWAITCONFIGER, "FModelessDlgProc", 0, "")
IF IsTTFEnabled = 1 THEN
WriteToLogFile "**** TTFEnabled ****"
'' Let's register the Symbols TTF,... FONTLIST1$ is an empty Symbole varaible
SetSymbolValue TempList$, "{}"
MakeListFromSectionKeys TempList$, "WFN"
FOR i% = 1 TO GetListLength(TempList$)
szFileName$ = GetSectionKeyFilename( "WFN", GetListItem(TempList$, i%))
index% = GetFilenameFromPath( szFileName$ )
szFileName2$ = MID$( szFileName$, index%, LEN(szFileName$) - index% + 1 )
IF MID$(szFileName2$, LEN(szFileName2$)-2) = "ttf" THEN
szFOTName$ = MID$(szFileName2$,1,LEN(szFileName2$)-3) + "fot"
RegisterFont MakePath(szWWinDir$,szFOTName$), MakePath(DIR(MAIN),TR_SYMBOLS+"\"+szFileName2$)
temp% = GetTypeFaceNameFromTTF( MakePath(DIR(MAIN),TR_SYMBOLS+"\"+szFileName2$), szString$, STRINGLEN )
IF temp% > 0 AND temp% < STRINGLEN THEN
CreateIniKeyValue TR_WIN_INI, "fonts", szString$+" "+TR_TRUETYPE, UCASE$(szFOTName$), cmoOverWrite
ENDIF
ENDIF
NEXT i%
SetSymbolValue TempList$, "{}"
MakeListFromSectionKeys TempList$, "DrawFonts"
WriteToLOgFile "Adding DrawFonts"
FOR nIndex% = 1 TO GetListLength(TempList$)
Font$ = GetListItem(TempList$, nIndex%)
szFileName$ = GetSectionKeyFilename("DrawFonts", Font$ )
index% = GetFilenameFromPath( szFileName$ )
szFileName2$ = MID$( szFileName$, index%, LEN(szFileName$) - index% + 1 )
szFOTName$ = MID$(szFileName2$,1,LEN(szFileName2$)-3) + "fot"
RegisterFont MakePath(szWWinDir$,szFOTName$), MakePath(DIR(FONTTT),szFileName2$)
temp% = GetTypeFaceNameFromTTF( MakePath(DIR(FONTTT),szFileName2$), szString$, STRINGLEN )
IF temp% > 0 AND temp% < STRINGLEN THEN
CreateIniKeyValue TR_WIN_INI, "fonts", szString$+" "+TR_TRUETYPE, UCASE$(szFOTName$), cmoOverWrite
ENDIF
szString$ = string$( STRINGLEN+1, 32 )
szFileName$ = ""
szFileName2$ = ""
szFOTName$ = ""
NEXT nIndex%
ENDIF
IF bMakeCorelSection% THEN
CheckBackupFile MakePath(WINDIR$,"win.ini"), MakePath(WINDIR$,"win.cor")
CreateIniKeyValue TR_WIN_INI, "CorelGraphics4", "Dir", MakePath(DIR(MAIN), TR_CONFIG), cmoOverWrite
ENDIF
RUN( TR_REGLOAD_S + " " + MakePath(WINSYSDIR$, "OLE2.REG") )
ini$ = MakePath( DIR(MAIN), TR_CONFIG+"\"+TR_CORELAPP_INI)
IF DoesFileExist( MakePath(ConfigDir$, "CORELAPP.BAK"), femExists ) = 0 THEN
oldini$ = MakePath( DIR(MAIN), TR_CONFIG+"\corelapp.bak")
ENDIF
CreateIniKeyValue ini$, "Config", "ProgramsDir", MakePath(DIR(MAIN),TR_PROGRAMS), cmoOverWrite
CreateIniKeyValue ini$, "Config", "DataDir", MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_DATA), cmoOverWrite
CreateIniKeyValue ini$, "Config", "CustomDir", MakePath(DIR(MAIN),TR_CUSTOM), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "DrawDir")
IF OldDir$ <> "" THEN
DIR(DRAW) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "DrawDir", DIR(DRAW), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "ChartDir")
IF OldDir$ <> "" THEN
DIR(CHART) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "ChartDir", DIR(CHART), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "ShowDir")
IF OldDir$ <> "" THEN
DIR(SHOW) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "ShowDir", DIR(SHOW), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "PhotoPaintDir")
IF OldDir$ <> "" THEN
DIR(PHOTO) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "PhotoPaintDir", DIR(PHOTO), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "MoveDir")
IF OldDir$ <> "" THEN
DIR(MOVE) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "MoveDir", DIR(MOVE), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "TraceDir")
IF OldDir$ <> "" THEN
DIR(TRACE) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "TraceDir", DIR(TRACE), cmoOverWrite
OldDir$ = GetIniKeyString(oldini$, "Config", "MosaicDir")
IF OldDir$ <> "" THEN
DIR(MOSAIC) = OldDir$
ENDIF
CreateIniKeyValue ini$, "Config", "MosaicDir", DIR(MOSAIC), cmoOverWrite
CreateIniKeyValue ini$, "Config", "FontsDir", MakePath(DIR(MAIN),TR_SYMBOLS), cmoOverWrite
CreateIniKeyValue ini$, "Config", "FiltersDir", DIR(FILTERS), cmoOverWrite
OldStr$ = GetIniKeyString(oldini$, "Registration", "UserName")
IF OldStr$ <> "" THEN
UserName$ = OldStr$
ELSE
UserName$ = "Anyone"
ENDIF
CreateIniKeyValue ini$, "Registration", "UserName", UserName$, cmoOverWrite
OldStr$ = GetIniKeyString(oldini$, "Registration", "SerialNumber")
IF OldStr$ <> "" THEN
SerialNumber$ = OldStr$
ELSE
SerialNumber$ = "Working Model"
ENDIF
CreateIniKeyValue ini$, "Registration", "SerialNumber", "Working Model", cmoOverWrite
ini$ = MakePath( DIR(MAIN), TR_CONFIG+"\"+TR_CORELPRN_INI)
CreateIniKeyValue ini$, "ColorPath", "CircuitPath", MakePath(DIR(MAIN),TR_CUSTOM), cmoOverwrite
ini$ = MakePath( DIR(MAIN), TR_CONFIG+"\"+TR_CORELFLT_INI)
CreateIniKeyValue ini$, "ColorPath", "CircuitPath", MakePath(DIR(MAIN),TR_CUSTOM), cmoOverWrite
CreateIniKeyValue ini$, "ColorPath", "CurvePath", MakePath(DIR(MAIN),TR_CUSTOM), cmoOverWrite
WrapCommentIniSection ini$, MakePath(Dir(MAIN),"___temp_"), "ImportFilters", MakePath(DIR(MAIN),TR_PROGRAMS+"\")
WrapCommentIniSection ini$, MakePath(Dir(MAIN),"___temp_"), "ExportFilters", MakePath(DIR(MAIN),TR_PROGRAMS+"\")
WrapCommentIniSection ini$, MakePath(Dir(MAIN),"___temp_"), "CorelAIExport", MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_DATA+"\")
WrapCommentIniSection ini$, MakePath(Dir(MAIN),"___temp_"), "CorelDXFExport", MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_DATA+"\")
ini$ = MakePath( DIR(MAIN), TR_CONFIG+"\"+TR_CORELFNT_INI)
WrapCommentIniSection ini$, MakePath(Dir(MAIN),"___temp_"), "Fonts", MakePath(DIR(MAIN),TR_SYMBOLS+"\")
WrapCommentIniSection ini$, MakePath(Dir(MAIN),"___temp_"), "Symbols", MakePath(DIR(MAIN),TR_SYMBOLS+"\")
CreateProgmanGroup TOOLGROUP$, "", cmoNone
ShowProgmanGroup TOOLGROUP$, 1, cmoNone
'' nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_RELEASENOTES, TR_WRITE_EXE + " " + MakePath(DIR(MAIN),TR_README_WRI), "", cmoOverwrite)
'' WrapFileChangeString MakePath(DIR(MAIN),TR_CONFIG+"\"+TR_CORELDRW_REG), MakePath(DIR(MAIN),"___temp_"), TR_CORELDRW_EXE, MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_CORELDRW_EXE)
'' WrapFileChangeString MakePath(DIR(MAIN),TR_CONFIG+"\"+TR_CORELDRW_REG), MakePath(DIR(MAIN),"___temp_"), TR_CDROL140_DLL, MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_CDROL140_DLL)
'' RUN( TR_REGLOAD_S + " " + MakePath(DIR(MAIN),TR_CONFIG+"\"+TR_CORELDRW_REG) )
ini$ = MakePath(DIR(MAIN), TR_CONFIG+"\"+TR_CORELDRW_INI)
CreateIniKeyValue ini$, "Config", "AutoBackupDir", MakePath(DIR(MAIN),TR_AUTOBACK), cmoOverwrite
CreateIniKeyValue ini$, "Config", "TemplateDir", MakePath(DIR(DRAW),TR_TEMPLATE), cmoOverwrite
nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW, MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_CORELDRW_EXE),"", cmoOverwrite)
UIPop 1 ''WAITCONFIGER Dialog
'' Installing SHARE
'' We don't want to install SHARE for Windows for Workgroups
IF bWindowsForWorkgroups% = FALSE THEN
Drive$ = CHR$( FGetBootDrive - 1 + ASC("A"))
ShareFile$ = FindFileInTree("SHARE.EXE", Drive$+":\")
IF ShareFile$ <> "" THEN
SetSymbolValue "ShareLine", "{}"
AddListItem "ShareLine", ShareFile$+" /L:500 /F:5100"
IF bAutoexecModified% = FALSE THEN
CopyFile Drive$+":\"+TR_AUTOEXEC_BAT, Drive$+":\"+TR_AUTOEXEC_COR, cmoOverwrite, 0
ENDIF
UPDATE:
WaitOff
sz$ = UIStartDlg( "mscuistf.dll", DRAWSHARE, "FButtonsDlgProc", DRAWSHAREHELP, "FHelpDlgProc" )
SELECT CASE sz$
CASE "U"
Res% = FModifyFile(Drive$+":\"+TR_AUTOEXEC_BAT, "ShareLine", "E")
CASE "D"
Res% = FModifyFile(Drive$+":\"+TR_AUTOEXEC_COR, "ShareLine", "E")
CASE ELSE
GOTO UPDATE
END SELECT
UIPop 1
ENDIF '' IF ShareFile <> ""
ENDIF '' IF bWindowsForWorkgroups% = FALSE
'' User has completed run of setup or has unconditionally decided to quit
QUIT:
WaitOff
'' On MSTest errors report "setup file corrupted" and abort
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = DRAWEXITSUCCESS
szDlgProc$ = "FInfo0DlgProc"
WriteToLogfile TR_SETUPSUCCEEDED
ELSEIF ERR = STFQUIT THEN
dlg% = DRAWEXITQUIT
szDlgProc$ = "FInfo0DlgProc"
WriteToLogfile TR_SETUPQUIT
ELSE
dlg% = DRAWERROREXITFAILURE
szDlgProc$ = "FInfo0DlgProc"
WriteToLogfile TR_SETUPFAILED
ENDIF
'' Put up one of the exit message dialog boxes
QUITL1:
sz$ = UIStartDlg("mscuistf.dll", dlg%, szDlgProc, 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
ENDIF
GOTO FINISH
'' An error has occurred in MSTest. Tell the user and abort.
ERRQUIT:
i% = DoMsgBox( "Files were corrupted, contact Corel Product Support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
WriteToLogfile "Setup Failed - files corrupted"
WriteToLogFile ""
FINISH:
UIPopAll
ShutDownInstall
CloseLogFile
END
ASKINSTALL:
WaitOff
sz$ = UIStartDlg( "mscuistf.dll", DRAWASKINSTALL, "FInfoDlgProc", 0, "" )
SELECT CASE sz$
CASE "CONTINUE"
''Do nothing
CASE "REACTIVATE"
GOTO ASKINSTALL
CASE ELSE
GOSUB ASKQUIT
GOTO ASKINSTALL
END SELECT
UIPop 1
RETURN ''return if the user want to update
'' Display an information dialog
'' Uses the global Dialog% to identify which dialog to display
INFO:
WaitOff
sz$ = UIStartDlg( "mscuistf.dll", Dialog%, "FInfo0DlgProc", 0, "" )
SELECT CASE sz$
CASE "CONTINUE"
''Do nothing
CASE "REACTIVATE"
GOTO INFO
CASE "EXIT"
GOSUB ASKQUIT
GOTO INFO
END SELECT
UIPop 1
RETURN
'' The user has asked to quit - confirm his decision
ASKQUIT:
WaitOff
sz$ = UIStartDlg("mscuistf.dll", DRAWASKQUIT, "FQuitDlgProc", 0, "")
SELECT CASE sz$
CASE "EXIT"
GOTO FINISH '' OK. I know I shouldn't do that, but it's OK, It's the end of the script.
CASE "REACTIVATE"
GOTO ASKQUIT
CASE ELSE
''Do nothing
END SELECT
UIPop 1
RETURN
'***********************************************************************
'***********************************************************************
'**** Get CorelDRAW! 4 main directory ********************
'***********************************************************************
GetAppsMainDir:
WriteToLogFile "GetPath:"
bRet% = FIsDrawExist(TR_WIN_INI, szString$)
IF bRet% THEN '' We have DRAW installed before (could be DRAW3 or DRAW4)
WriteToLogFile "String Found For Directory is"+ szString$
IF DoesFileExist( MakePath(szString$, "programs\coreldrw.exe"), femExists ) = 1 THEN
Dialog% = DRAWERRORDRAWEXIST
GOSUB INFO
ERR = STFERR
GOTO QUIT
ENDIF
DEST$ = szString$
DIR(MAIN) = DEST$
SetDirectories
ENDIF
Dialog% = DRAWDESTPATH
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
WaitOff
sz$ = UIStartDlg("mscuistf.dll", Dialog%, "FEditDlgProc", 0, "")
SELECT CASE sz$
CASE "CONTINUE"
WaitOn
olddest$ = DEST$
DEST$ = RTRIM$(LTRIM$(GetSymbolValue("EditTextOut")))
''Validate new path.
IF DEST$ = "" OR IsDirWritable(DEST$) = 0 THEN
OldDialog% = Dialog%
Dialog% = DRAWERRORBADPATH
GOSUB INFO
Dialog% = OldDialog%
GOTO GETPATHL1
ENDIF
CASE "REACTIVATE"
GOTO GETPATHL1
CASE "CANCEL", "BACK"
UIPop 1
bBack% = TRUE
RETURN
CASE ELSE
GOSUB ASKQUIT
GOTO GETPATHL1
END SELECT
WriteToLogFile TR_BASEDIR + DEST$
WriteToLogFile ""
UIPop 1
RETURN
'*************************************************************************
'*************************************************************************
'**** Add files to copy list according to the bUpdate flags **************
'*************************************************************************
'*************************************************************************
SUB AddFilesToCopyList STATIC
WriteToLogFile "AddFilesToCopyList"
WriteToLogFile "AddFilesToCopyList: DRAW"
AddSectionFilesToCopyList "DrawMain", SrcDir$, MakePath(DIR(MAIN),TR_PROGRAMS)
AddSectionFilesToCopyList "DrawDraw", SrcDir$, DIR(DRAW)
'' AddSectionFilesToCopyList "DrawEhandler", SrcDir$, MakePath(DIR(DRAW), TR_EHANDLER)
AddSectionFilesToCopyList "DrawConfig", SrcDir$, MakePath(DIR(MAIN),TR_CONFIG)
AddSectionFilesToCopyList "DrawHelp", SrcDir$, MakePath(DIR(MAIN),TR_PROGRAMS)
AddSectionFilesToCopyList "DrawTemplate", SrcDir$, MakePath(DIR(DRAW),TR_TEMPLATE)
AddSectionFilesToCopyList "DrawSamples", SrcDir$, MakePath(DIR(DRAW), TR_SAMPLES)
''The Common Bullets should be always installed with DRAW
WriteToLogFile "AddFilesToCopyList: WFN"
AddSectionKeyFileToCopyList "WFN", TR_COMMONBULLETS, SrcDir$, MakePath(DIR(MAIN),TR_SYMBOLS)
WriteToLogFile "AddFilesToCopyList: TTF"
AddSectionFilesToCopyList "DrawFonts", SrcDir$, DIR(FONTTT)
WriteToLogFile "AddFilesToCopyList: MAIN & COMMON"
'' AddSectionFilesToCopyList "Main", SrcDir$, DIR(MAIN)
AddSectionFilesToCopyList "CommonDLL", SrcDir$, MakePath(DIR(MAIN),TR_PROGRAMS)
AddSectionFilesToCopyList "CommonConfig", SrcDir$, MakePath(DIR(MAIN),TR_CONFIG)
AddSectionFilesToCopyList "Custom", SrcDir$, MakePath(DIR(MAIN),TR_CUSTOM)
AddSectionFilesToCopyList "ProgramData", SrcDir$, MakePath(DIR(MAIN),TR_PROGRAMS+"\"+TR_DATA)
AddRedistSection "CommonRedist"
WriteToLogFile "AddFilesToCopyList: FILTERS"
AddSectionFilesToCopyList "ImpFilters", SrcDir$, DIR(FILTERS)
'' AddSectionFilesToCopyList "ImpFiltersDrMoTr", SrcDir$, DIR(FILTERS)
'' AddSectionFilesToCopyList "ImpFiltersDrMoPhTr", SrcDir$, DIR(FILTERS)
'' AddSectionFilesToCopyList "ExpFiltersDrPh", SrcDir$, DIR(FILTERS)
END SUB
'**
'** Purpose:
'** Removes the optional trailing "\"
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** Returns:
'** szDir$ without a trailing "\"
'*************************************************************************
FUNCTION MakeDir (szDir$) STATIC AS STRING
IF szDir$ <> "" THEN
IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakeDir = MID$( szDir$, 1, LEN(szDir$) - 1 )
ELSE
MakeDir = szDir$
ENDIF
ELSE
MakeDir = szDir$
ENDIF
END FUNCTION
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
MakePath = MakeDir(szDir$) + "\" + szFile$
END FUNCTION
'** Make sure that the long wait dialog is displayed and the hourglass cursor
'** are being used
'*************************************************************************
SUB WaitOnBig STATIC
IF nWaiting% = 0 THEN
CursorSave% = ShowWaitCursor()
ENDIF
IF nWaiting% <> 2 THEN
sz$ = UIStartDlg("mscuistf.dll", DRAWWAIT, "FModelessDlgProc", 0, "")
ENDIF
nWaiting% = 2
END SUB
'** Make sure that the hourglass cursor is being used
'*************************************************************************
SUB WaitOn STATIC
IF nWaiting% = 0 THEN
CursorSave% = ShowWaitCursor()
nWaiting% = 1
ENDIF
END SUB
'** Remove the long wait dialog if it is being displayed and reset the cursor
'** back to normal if it was set to the hourglass icon
'*************************************************************************
SUB WaitOff STATIC
IF nWaiting% = 2 THEN
UIPop 1
ENDIF
IF nWaiting% <> 0 THEN
RestoreCursor CursorSave%
ENDIF
nWaiting% = 0
END SUB
'** Wrapper function - should reduce size of code segment.
'**
'** FileChangeString replaces szString1$ in szFile1$ with szString2$.
'** szFile2$ is a temporary file name.
'*************************************************************************
SUB WrapFileChangeString( szFile1$, szFile2$, szString1$, szString2$ ) STATIC
FileChangeString szFile1$, szFile2$, szString1$, szString2$
END SUB
'** Wrapper function - should reduce size of code segment.
'**
'** CommentIniSection checks to see whether or not the files mentioned in
'** szSection$ can be found in directory szPath$. If not, it sticks a ';'
'** in front of that line of the ini file. Otherwise it makes sure there
'** is not semi-colon commenting out that line.
'** Note: this function is heavily dependent on the format of coreldrw.ini
'*************************************************************************
SUB WrapCommentIniSection( szFileName$, szTempFile$, szSection$, szPath$ ) STATIC
CommentIniSection szFileName$, szTempFile$, szSection$, szPath$
END SUB
'** If the second file does not exist, backup szFile1$ as szFile2$
'*************************************************************************
SUB CheckBackupFile( szFile1$, szFile2$ ) STATIC
IF DoesFileExist(szFile2$,femExists) = 0 AND DoesFileExist(szFile1$,femExists) THEN
CopyFile szFile1$, szFile2$, cmoNone, 0
ENDIF
END SUB
'***********************************************************************
'***********************************************************************
'**** CalculateRequiredSpace on the destination disk ******************
'***********************************************************************
SUB CalculateRequiredSpace STATIC
WriteToLogFile "SUB CalculateRequiredSpace"
bTooBig% = FALSE
StillNeed& = GetCopyListCost(EXTRACOSTS$, aszNEEDS$, "")
IF StillNeed& THEN
bTooBig% = TRUE
ENDIF
END SUB
'*************************************************************************
FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC AS INTEGER
szItemNew$ = szItem$
IF szOther$ <> "" THEN
szItemNew$ = szItem$ + "," + szOther$
END IF
IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
CreateProgmanItem = 1
ELSE
CreateProgmanItem = 0
END IF
'' szItemNew$ = ""
END FUNCTION
'** Set the subdirectories to their default values.
'*************************************************************************
SUB SetDirectories STATIC
IF bWindowsIsNetworked% THEN
szFontDir$ = WINDIR$
szWWinDir$ = WINDIR$
ELSE
szFontDir$ = WINSYSDIR$
szWWinDir$ = WINSYSDIR$
ENDIF
DIR(MAIN) = DEST$
DIR(DRAW) = MakePath( DIR(MAIN), TR_DRAW )
DIR(CHART) = MakePath( DIR(MAIN), TR_CHART )
DIR(SHOW) = MakePath( DIR(MAIN), TR_SHOW )
DIR(PHOTO) = MakePath( DIR(MAIN), TR_PHOTOPNT )
DIR(MOVE) = MakePath( DIR(MAIN), TR_MOVE )
DIR(TRACE) = MakePath( DIR(MAIN), TR_TRACE )
DIR(MOSAIC) = MakePath( DIR(MAIN), TR_PROGRAMS )
DIR(SCANNERS) = MakeDir(szScannerDir$)
DIR(FILTERS) = MakePath( DIR(MAIN), TR_PROGRAMS )
DIR(FONTTT) = MakeDir(szFontDir$)
'' szFontDir$ = ""
END SUB
'** Add Redistributable files to the correct directory(s) in the copy list
'*************************************************************************
SUB AddRedistSection( szSection$) STATIC
IF bWindowsIsNetworked% OR bInstallNet% = FALSE THEN
'' Copy the redistributable files and dlls to windir or winsysdir
AddSectionFilesToCopyList szSection$, SrcDir$, szWWinDir$
ENDIF
IF bInstallNet% THEN
'' Store the redistributable files in REDIST until user installs
AddSectionFilesToCopyList szSection$, SrcDir$, MakePath(DIR(MAIN),TR_REDIST)
ENDIF
END SUB